package com.qyer.search.model.aggregation;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.LinkedHashMap;
import java.util.List;

/**
 * Created by tangzheng on 16/7/17.
 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class Intention {

  @JsonProperty
  //@JsonInclude(JsonInclude.Include.NON_NULL)
  private Prefer prefer;
  @JsonProperty
  //@JsonInclude(JsonInclude.Include.NON_NULL)
  private List<Segment> segmentation;

  public Intention(Prefer prefer, List<Segment> segmentation) {
    this.prefer = prefer;
    this.segmentation = segmentation;
  }

  public Prefer getPrefer() {
    return prefer;
  }

  public void setPrefer(Prefer prefer) {
    this.prefer = prefer;
  }

  public List<Segment> getSegmentation() {
    return segmentation;
  }

  public void setSegmentation(List<Segment> segmentation) {
    this.segmentation = segmentation;
  }

  @Override public boolean equals(Object o) {
    if (this == o)
      return true;
    if (o == null || getClass() != o.getClass())
      return false;

    Intention intention = (Intention) o;

    if (!prefer.equals(intention.prefer))
      return false;
    return segmentation.equals(intention.segmentation);

  }

  @Override public int hashCode() {
    int result = prefer.hashCode();
    result = 31 * result + segmentation.hashCode();
    return result;
  }
}
